#ifndef TCPSERVER_H
#define TCPSERVER_H

#include <QObject>
#include <QTextStream>
#include <QList>
#include <QtNetwork>
#include <QMessageBox>
#include "hrac.h"

class TcpServer : public QObject
{
    Q_OBJECT
public:
    TcpServer(QHostAddress addr, int port, Hrac * hrac);
    bool listening;
private:
    QTcpServer * server;
    Hrac * zakladajiciHrac;
    void sendHi(QTcpSocket* socket, Hrac * hrac);
    void sendTah(QTcpSocket* socket, Tah * tah);
    void sendNewgame(QTcpSocket* socket);
    void socketWrite(QTcpSocket* socket, QByteArray data);
private slots:
    void newConnection();
    void reply();
    void got_Disconnected();
signals:
    void new_connection(QTcpSocket * socket);
    void new_Hrac_data(Hrac * hrac);
    void new_Tah_data(Tah * tah);
    void new_game_requested();
};

#endif // TCPSERVER_H
